package main

import (
	"net/http"
	"log"
	"github.com/leesper/holmes"
	"io"
)

// hello world, the web server
func HelloServer(w http.ResponseWriter, req *http.Request) {
	holmes.Infoln("Method:" + req.Method)
	holmes.Infoln("Url:" + req.URL.String())
	holmes.Infoln("name:" + req.FormValue("name"))
	holmes.Infoln("size:" + req.FormValue("size"))

	io.WriteString(w, "hello, world!\n")
}

func app(w http.ResponseWriter, req *http.Request) {
	//holmes.Infoln("app Method:" + req.Method)
	holmes.Infoln("Url:" + req.URL.String())
	io.WriteString(w, "hello, app!\n")
}

func main()  {
	defer holmes.Start().Stop()
	http.HandleFunc("/hello", HelloServer)
	http.HandleFunc("/video/upload/upload", app)
	http.HandleFunc("/video/upload/uploa/", app)

	log.Fatal(http.ListenAndServe(":8080", nil))

}
